package cn.jly.springboot24.controller;

import cn.jly.springboot24.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @PackageName cn.jly.springboot24.controller
 * @ClassName LoginController
 * @Description
 * @Author 姬岚洋
 * @Date 2021/1/17 下午 6:18
 */
@Controller
public class LoginController {
    @ResponseBody
    @GetMapping("/login")
    public String login(HttpServletRequest request) {
        final User user = new User(1001L, "姬岚洋");
        request.getSession().setAttribute("loginUser", user);
        return "登录成功, " + user.getUsername();
    }
}
